﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Collections;

using XJX.BusinessLayer;

namespace XJX.Page
{
    /// <summary>
    /// </summary>
    public class Listening
    {
        public Listening()
        {        }

        static string str = System.Configuration.ConfigurationManager.ConnectionStrings["DataConn"].ConnectionString;

        static XJX.BusinessLayer.Listening bs = new XJX.BusinessLayer.Listening(str);

        public static bool LB_Add_New_ListeningBook_Info
            (
            string Title,
            string Description,
            string AnnouncerInfo,
            string FileInfo,
            string TimeLength,
            string BookLinkPic,
            string BookLinkInfo,
            out int ReturnValue,          //返回参数值
            out string ReturnFieldValue   //返回字段值,返回插入的新值ID编号
            )
        {
            bool b;

            try
            {
                b = bs.LB_Add_New_ListeningBook_Info(Title, Description, AnnouncerInfo, FileInfo, TimeLength, BookLinkPic, BookLinkInfo, out ReturnValue, out ReturnFieldValue);
            }
            catch (SqlException e)
            {
                throw new System.Exception(e.Message);
            }
            return b;
        }

        public static bool LB_Del_One_ListeningBook_From_LBID(string LBID)
        {
            bool b;

            try
            {
                b = bs.LB_Del_One_ListeningBook_From_LBID(LBID);
            }
            catch (SqlException e)
            {
                throw new System.Exception(e.Message);
            }
            return b;
        }

        public static bool LB_Modify_One_ListeningBook_Info
            (
            string LBID,
            string Title,
            string Description,
            string AnnouncerInfo,
            string FileInfo,
            string TimeLength,
            string BookLinkPic,
            string BookLinkInfo
            )
        {
            bool b;

            try
            {
                b = bs.LB_Modify_One_ListeningBook_Info(LBID, Title, Description, AnnouncerInfo, FileInfo, TimeLength, BookLinkPic, BookLinkInfo);
            }
            catch (SqlException e)
            {
                throw new System.Exception(e.Message);
            }
            return b;
        }

        //得到一个节目内容
        public static string Get_One_ListeningBook_Info_From_LBID(string LBID)
        {
            Hashtable ht = bs.Get_One_ListeningBook_Info_From_LBID(LBID);
            return XJX.BusinessLayer.JSON.Encode(ht);
        }

        //一般浏览用户或者管理员获取交流主题的标题列表
        public static string LB_Search_ListeningBook_List
            (
            string Title,
            string IsAll,

            int PageIndex,
            int PageSize
            )
        {
            Hashtable ht = bs.LB_Search_ListeningBook_List(Title, IsAll, PageIndex, PageSize);
            return XJX.BusinessLayer.JSON.Encode(ht);
        }

        //屏蔽或显示一条
        public static bool LB_ShieldORDisp_One_ListeningBook_By_LBID
        (
            string LBID,
            out int ReturnValue,
            out string ReturnFieldValue
            )
        {
            bool b;

            try
            {
                b = bs.LB_ShieldORDisp_One_ListeningBook_By_LBID(LBID, out ReturnValue, out ReturnFieldValue);
            }
            catch (SqlException e)
            {
                throw new System.Exception(e.Message);
            }
            return b;
        }


        //置顶一条
        public static bool LB_StickORCannel_One_ListeningBook_By_LBID
        (
            string LBID,
            out int ReturnValue,
            out string ReturnFieldValue
            )
        {
            bool b;

            try
            {
                b = bs.LB_StickORCannel_One_ListeningBook_By_LBID(LBID, out ReturnValue, out ReturnFieldValue);
            }
            catch (SqlException e)
            {
                throw new System.Exception(e.Message);
            }
            return b;
        }


    }
}